home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / LB09D.ZIP / SUMMARY.TXT < prev    next >
Text File  |  1992-12-03  |  52KB  |  1,759 lines

  1.  
  2. This file describes the many commands and functions of Liberty BASIC.  
  3. The format goes like this:
  4.  
  5.  
  6. Command/Function Name and Syntax  optional items in gray
  7.  
  8.  
  9. Description:
  10.     a short, exact specification for the command/function
  11.  
  12. Usage:
  13.     an example of how to use the function command in a short
  14.     Liberty BASIC program fragment
  15.  
  16.  
  17.  
  18. Explore the included Liberty BASIC source files for more information.
  19.  
  20.  
  21. See the section at the end of this file about commands for controlling
  22. the spreadsheet, graphics, and text windows.
  23.  
  24.  
  25. NOTE: This file is designed to be dumped to a printer with FF characters
  26.       to place each statement or function at the top of the next page.
  27.       For most, this is accomplished simply enough:
  28.  
  29.       C:\LIBERTY>type summary.txt > lpt1:
  30.  
  31.       or you could simply print this file from the Windows Notepad
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. ASC( n$ )
  40.  
  41. Description:
  42.  
  43.   This function returns the ASCII value of the first character of string n$.
  44.  
  45. Usage:
  46.  
  47.   print asc( "A" )              produces:  65
  48.  
  49.   let name$ = "Tim"
  50.   firstLetter = asc(name$)
  51.   print firstLetter             produces:  84
  52.  
  53.   print asc( "" )               produces:  0
  54.  
  55. BEEP
  56.  
  57. Description:
  58.  
  59.   This command simply rings the system bell, as in CTRL-G
  60.  
  61. Usage:
  62.  
  63.   .
  64.   .
  65. [loop]
  66.   input "Give me a number between 1 and 10?"; number
  67.   if number < 1 or number > 10 then beep : print "Out of range!" : goto [loop]
  68.   print "The square of "; number; " is "; number ^ 2
  69.   .
  70.   .
  71.  
  72.  
  73. BUTTON #handle, label, return, corner, posx, posy
  74.  
  75. Description:
  76.  
  77.   This statement lets you add buttons to windows that you open.  The main 
  78.   program window cannot have buttons added, but any window that you create 
  79.   via the OPEN command can have as many buttons as you want.  In this release 
  80.   of Liberty BASIC, buttons cannot have graphic pictures on them, but only 
  81.   text labels.  This will be remedied in a future release.
  82.  
  83. Usage:
  84.  
  85.   Before you actually OPEN the window, each button must be declared with a 
  86.   BUTTON statement.  Here is a brief description for each parameter as listed 
  87.   above:
  88.  
  89. #handle - any valid file handle may be used.  You must use the same handle
  90.       as will be used for the window that the button will belong to.
  91.  
  92. label   - Type the label desired for the button here.  Do not bound the word
  93.       with quotes, and do not use a string variable.
  94.  
  95. return  - Again, use only one word and do not bound it with quotes or use a
  96.       string variable.  If return is set to a valid branch label, then when
  97.       the button is pressed, execution will restart there (just as with
  98.       GOTO or GOSUB), but if return is not a valid branch label, then the 
  99.       value of return is used as input to a specified variable (as in 
  100.       input a$).
  101.  
  102. corner  - UL, UR, LL, or LR specifies which corner of the window to anchor
  103.       the button to.  For example, if LR is used, then the button will 
  104.       appear in the lower right corner.  UL = upper left, UR = upper 
  105.       right, LL = lower left, and LR = lower right
  106.  
  107. posx, posy - These two parameters determine how to place the button relative to
  108.       the corner it has been anchored to.  For example if corner is LR, 
  109.       posx is 5, and posy is 5, then the button will be 5 pixels up and 
  110.       left of the lower right corner.  Another way to use posx & posy is
  111.       to use values less than one.  For example, if corner is UL, posx
  112.       is .9, and posy is .9, then the button will be positioned 9/10th of 
  113.       the distance of the window in both x and y from the upper left
  114.       corner (and thus appear to be anchored to the lower right corner). 
  115.  
  116.  
  117.  
  118.  
  119.  
  120. BUTTON Continued
  121.  
  122. Here is a sample program:
  123.  
  124.   ' this button will be labeled Sample and will be located
  125.   ' in the lower right corner.  When it is pressed, program
  126.   ' execution will transfer to [test]
  127.     button #graph, Sample, [test], LR, 5, 5
  128.  
  129.   ' this button will be labeled Example and will be located
  130.   ' in the lower left corner.  When it is pressed, the string
  131.   ' "Example" will be returned.
  132.     button #graph, Example, Example, LL, 5, 5
  133.  
  134.   ' open a window for graphics
  135.     open "Button Sample" for graphics as #graph
  136.  
  137.   ' print a message in the window
  138.     print #graph, "\This is a test"
  139.  
  140.   ' get button input
  141. [loop]
  142.   input b$
  143.   if b$ = "Example" then [example]
  144.   goto [loop]
  145.  
  146.  ' the Sample button has been pressed, ring the terminal bell
  147.  ' and close the window
  148. [test]
  149.   beep
  150.   close #graph
  151.   end
  152.  
  153.  ' The Example button has been pressed, close the window
  154.  ' without ringing the bell
  155. [example]
  156.   close #graph
  157.   end
  158.  
  159.  
  160. CHR$( n )
  161.  
  162. Description:
  163.  
  164.   Returns a one character long string, consisting of the character 
  165.   represented on the ASCII table by the value n (0 - 255).
  166.  
  167. Usage:
  168.  
  169.   ' print each seperate word in text$ on its own line
  170.   text$ = "now is the time for all great men to rise"
  171.   for index = 1 to len(text$)
  172.       c$ = mid$(text$, index, 1)
  173.       ' if c$ is a space, change it to a carraige return
  174.       if c$ = chr$(32) then c$ = chr$(13)
  175.       print c$ ;
  176.   next index                            Produces:
  177.  
  178.                 now
  179.                 is
  180.                 the
  181.                 time
  182.                 for
  183.                 all
  184.                 great
  185.                 men
  186.                 to
  187.                 rise
  188.  
  189.  
  190. CLOSE #handle
  191.  
  192. Description:
  193.  
  194.   This command is used to close files and devices.  This is the last step of 
  195.   a file read and/or write, or to close graphic, spreadsheet, or other 
  196.   windows when finished with them.  If when execution of a program is 
  197.   complete there are any files or devices left open, Liberty BASIC will 
  198.   display a dialog informing you that it found it necessary to close the 
  199.   opened files or devices.  This is designed as an aid for you so that you 
  200.   will be able to correct the problem.  If on the other hand you choose to 
  201.   terminate the program early (this is done by closing the program's main 
  202.   window before the program finishes), then Liberty BASIC will close any open 
  203.   files or devices without posting a notice to that effect.
  204.  
  205. Usage:
  206.  
  207.   open "Graphic" for graphics as #gWindow       ' open a graphics window
  208.   print #gWindow, "home"                ' center the pen
  209.   print #gWindow, "down"                ' put the pen down
  210.   for index = 1 to 100                  ' loop 100 times
  211.     print #gWindow, "go "; index                ' move the pen foreward
  212.     print #gWindow, "turn 63"           ' turn 63 degrees
  213.   next index
  214.   input "Press 'Return'."; r$           ' this appears in main window
  215.   close #gWindow                        ' close graphic window
  216.  
  217.  
  218. CLS
  219.  
  220. Description:
  221.  
  222.   Clears the main program window of text and sets the cursor back at the 
  223.   upper left hand corner.  Useful  for providing a break to seperate 
  224.   different sections of a program functionally.  Additionally, since the main 
  225.   window doesn't actually discard past information on its own, the CLS 
  226.   command can be used to reclaim memory from your program by forcing the main 
  227.   window to dump old text.
  228.  
  229. Usage:
  230.  
  231.   .
  232.   .
  233.   print "The total is: "; grandTotal
  234.   input "Press 'Return' to continue."; r$
  235.   cls
  236.   print "*** Enter Next Round of Figures ***"
  237.   .
  238.   .
  239.  
  240.  
  241. CONFIRM string; responseVar
  242.  
  243. Description:
  244.  
  245.   This statement opens a dialog box displaying the contents of string and 
  246.   presenting two buttons marked 'Yes' and 'No'.  When the selection is made, 
  247.   the string "yes" is returned if 'Yes' is pressed, and the string "no" is 
  248.   returned if 'No' is pressed.  The result is placed in responseVar.
  249.  
  250. Usage:
  251.  
  252. [quit]
  253.  
  254.   ' bring up a confirmation box to be sure that
  255.   ' the user want to quit
  256.   confirm "Are you sure you want to QUIT?"; answer$
  257.   if answer$ = "no" then [mainLoop]
  258.   end
  259.  
  260.  
  261. COS( n )
  262.  
  263. Description:
  264.  
  265.   Returns the cosine of the number n.
  266.  
  267. Usage:
  268.  
  269.   .
  270.   .
  271.   for c = 1 to 45
  272.     print "The cosine of "; c; " is "; cos(c)
  273.   next c
  274.   .
  275.   .
  276.  
  277. Note:
  278.  
  279.   See also SIN( ) and TAN( )
  280.  
  281.  
  282. DATE$( )
  283.  
  284. Description:
  285.  
  286.   Instead of adopting MBASIC's date$ variable, we decided to use a functi